import java.util.ArrayList;

import net.sf.json.JSONObject;


public class LaserScan {
	
	private LaserProperties properties;
	private ArrayList<Double> lasersEchoes;
	private ArrayList<Double> lasersOverflow;
	private ArrayList<Double> lasersReflector;

	public LaserScan(ArrayList<Double> lasers) {
		this.lasersEchoes = lasers;
	}

	public ArrayList<Double> getLasersEchoes() {
		return lasersEchoes;
	}

	public void setLasersEchoes(ArrayList<Double> lasers) {
		this.lasersEchoes = lasers;
	}
	
	public void setLaserPropertiesFromJSON(JSONObject obj){ 
		Pose p = new Pose();
		p.setPoseFromJSONObject(obj.getJSONObject("Pose"));
		properties = new LaserProperties(obj.getDouble("AngleIncrement"), obj.getDouble("EndAngle"), obj.getDouble("StartAngle"), p);
	}
	
	public void setLasersEchoesFromJSON(JSONObject obj){
		lasersEchoes.clear();
		lasersEchoes.addAll(obj.getJSONArray("Echoes"));
		lasersOverflow.clear();
		lasersOverflow.addAll(obj.getJSONArray("Overflow"));
		lasersReflector.clear();
		lasersReflector.addAll(obj.getJSONArray("Reflector"));
	}
	
	
}
